<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>QuantumLibrary: Bloomberg::quantum::SpinLock Class Reference</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtreedata.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">QuantumLibrary
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('../../',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html','../../');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="../../da/d23/classBloomberg_1_1quantum_1_1SpinLock-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">Bloomberg::quantum::SpinLock Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Coroutine-compatible spinlock. Used internally for mutexes since threads running coroutines cannot block.  
 <a href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="../../d5/d5d/quantum__spinlock_8h_source.html">quantum_spinlock.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../db/de4/classBloomberg_1_1quantum_1_1SpinLock_1_1Guard.html">Guard</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d36/classBloomberg_1_1quantum_1_1SpinLock_1_1ReverseGuard.html">ReverseGuard</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:a7b02a9641f8dc0fd1ed49da0727544bd"><td class="memItemLeft" align="right" valign="top">using&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html#a7b02a9641f8dc0fd1ed49da0727544bd">TryToLock</a> = std::try_to_lock_t</td></tr>
<tr class="separator:a7b02a9641f8dc0fd1ed49da0727544bd"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ae5c44ace294ef6f289c41b1eb5944db1"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html#ae5c44ace294ef6f289c41b1eb5944db1">SpinLock</a> ()</td></tr>
<tr class="memdesc:ae5c44ace294ef6f289c41b1eb5944db1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor. The object is in the unlocked state.  <a href="#ae5c44ace294ef6f289c41b1eb5944db1">More...</a><br /></td></tr>
<tr class="separator:ae5c44ace294ef6f289c41b1eb5944db1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aea9aed454e7074f5067b97ad389498cc"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html#aea9aed454e7074f5067b97ad389498cc">SpinLock</a> (const <a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html">SpinLock</a> &amp;)=delete</td></tr>
<tr class="memdesc:aea9aed454e7074f5067b97ad389498cc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy constructor.  <a href="#aea9aed454e7074f5067b97ad389498cc">More...</a><br /></td></tr>
<tr class="separator:aea9aed454e7074f5067b97ad389498cc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a02366176fbe6cc27793af22bf55f342f"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html#a02366176fbe6cc27793af22bf55f342f">SpinLock</a> (<a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html">SpinLock</a> &amp;&amp;)=default</td></tr>
<tr class="memdesc:a02366176fbe6cc27793af22bf55f342f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Move constructor.  <a href="#a02366176fbe6cc27793af22bf55f342f">More...</a><br /></td></tr>
<tr class="separator:a02366176fbe6cc27793af22bf55f342f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad99101ec9f150115298b8f2eeed53e24"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html">SpinLock</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html#ad99101ec9f150115298b8f2eeed53e24">operator=</a> (const <a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html">SpinLock</a> &amp;)=delete</td></tr>
<tr class="memdesc:ad99101ec9f150115298b8f2eeed53e24"><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy assignment operator.  <a href="#ad99101ec9f150115298b8f2eeed53e24">More...</a><br /></td></tr>
<tr class="separator:ad99101ec9f150115298b8f2eeed53e24"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a04c873bd000441e7fd21e532e606c8f3"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html">SpinLock</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html#a04c873bd000441e7fd21e532e606c8f3">operator=</a> (<a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html">SpinLock</a> &amp;&amp;)=default</td></tr>
<tr class="memdesc:a04c873bd000441e7fd21e532e606c8f3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Move assignment operator.  <a href="#a04c873bd000441e7fd21e532e606c8f3">More...</a><br /></td></tr>
<tr class="separator:a04c873bd000441e7fd21e532e606c8f3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a09b87ac342dc40720bb3161758b97ccd"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html#a09b87ac342dc40720bb3161758b97ccd">lock</a> ()</td></tr>
<tr class="memdesc:a09b87ac342dc40720bb3161758b97ccd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Locks this object.  <a href="#a09b87ac342dc40720bb3161758b97ccd">More...</a><br /></td></tr>
<tr class="separator:a09b87ac342dc40720bb3161758b97ccd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a701716227a6034d24a18f1a30ee9c6ce"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html#a701716227a6034d24a18f1a30ee9c6ce">tryLock</a> ()</td></tr>
<tr class="memdesc:a701716227a6034d24a18f1a30ee9c6ce"><td class="mdescLeft">&#160;</td><td class="mdescRight">Attempt to acquire the lock.  <a href="#a701716227a6034d24a18f1a30ee9c6ce">More...</a><br /></td></tr>
<tr class="separator:a701716227a6034d24a18f1a30ee9c6ce"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a530d6ca8dc3002ef5e9b90d8743cb10f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html#a530d6ca8dc3002ef5e9b90d8743cb10f">unlock</a> ()</td></tr>
<tr class="memdesc:a530d6ca8dc3002ef5e9b90d8743cb10f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Unlocks the current object.  <a href="#a530d6ca8dc3002ef5e9b90d8743cb10f">More...</a><br /></td></tr>
<tr class="separator:a530d6ca8dc3002ef5e9b90d8743cb10f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Coroutine-compatible spinlock. Used internally for mutexes since threads running coroutines cannot block. </p>
</div><h2 class="groupheader">Member Typedef Documentation</h2>
<a id="a7b02a9641f8dc0fd1ed49da0727544bd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7b02a9641f8dc0fd1ed49da0727544bd">&#9670;&nbsp;</a></span>TryToLock</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">using <a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html#a7b02a9641f8dc0fd1ed49da0727544bd">Bloomberg::quantum::SpinLock::TryToLock</a> =  std::try_to_lock_t</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="ae5c44ace294ef6f289c41b1eb5944db1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae5c44ace294ef6f289c41b1eb5944db1">&#9670;&nbsp;</a></span>SpinLock() <span class="overload">[1/3]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">Bloomberg::quantum::SpinLock::SpinLock </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Constructor. The object is in the unlocked state. </p>

</div>
</div>
<a id="aea9aed454e7074f5067b97ad389498cc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aea9aed454e7074f5067b97ad389498cc">&#9670;&nbsp;</a></span>SpinLock() <span class="overload">[2/3]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">Bloomberg::quantum::SpinLock::SpinLock </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html">SpinLock</a> &amp;&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">delete</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Copy constructor. </p>

</div>
</div>
<a id="a02366176fbe6cc27793af22bf55f342f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a02366176fbe6cc27793af22bf55f342f">&#9670;&nbsp;</a></span>SpinLock() <span class="overload">[3/3]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">Bloomberg::quantum::SpinLock::SpinLock </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html">SpinLock</a> &amp;&amp;&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">default</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Move constructor. </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a09b87ac342dc40720bb3161758b97ccd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a09b87ac342dc40720bb3161758b97ccd">&#9670;&nbsp;</a></span>lock()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Bloomberg::quantum::SpinLock::lock </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Locks this object. </p>
<dl class="section note"><dt>Note</dt><dd>Blocks the current thread until the lock is acquired. Blocking is achieved via a busy loop and the thread is not re-scheduled by the operating system. </dd></dl>

</div>
</div>
<a id="ad99101ec9f150115298b8f2eeed53e24"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad99101ec9f150115298b8f2eeed53e24">&#9670;&nbsp;</a></span>operator=() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html">SpinLock</a>&amp; Bloomberg::quantum::SpinLock::operator= </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html">SpinLock</a> &amp;&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">delete</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Copy assignment operator. </p>

</div>
</div>
<a id="a04c873bd000441e7fd21e532e606c8f3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a04c873bd000441e7fd21e532e606c8f3">&#9670;&nbsp;</a></span>operator=() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html">SpinLock</a>&amp; Bloomberg::quantum::SpinLock::operator= </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html">SpinLock</a> &amp;&amp;&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">default</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Move assignment operator. </p>

</div>
</div>
<a id="a701716227a6034d24a18f1a30ee9c6ce"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a701716227a6034d24a18f1a30ee9c6ce">&#9670;&nbsp;</a></span>tryLock()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool Bloomberg::quantum::SpinLock::tryLock </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Attempt to acquire the lock. </p>
<dl class="section return"><dt>Returns</dt><dd>True if successful, false otherwise. </dd></dl>
<dl class="section note"><dt>Note</dt><dd>This function never blocks. </dd></dl>

</div>
</div>
<a id="a530d6ca8dc3002ef5e9b90d8743cb10f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a530d6ca8dc3002ef5e9b90d8743cb10f">&#9670;&nbsp;</a></span>unlock()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void Bloomberg::quantum::SpinLock::unlock </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Unlocks the current object. </p>
<dl class="section note"><dt>Note</dt><dd>Never blocks. </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="../../d6/db9/namespaceBloomberg.html">Bloomberg</a></li><li class="navelem"><a class="el" href="../../dc/d48/namespaceBloomberg_1_1quantum.html">quantum</a></li><li class="navelem"><a class="el" href="../../d1/d05/classBloomberg_1_1quantum_1_1SpinLock.html">SpinLock</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.15 </li>
  </ul>
</div>
</body>
</html>
